package com.codemonkey.lq.qd.builder.support;

import java.util.ArrayList;
import java.util.List;

import com.codemonkey.lq.qd.builder.BaseBuilder;
import com.codemonkey.lq.qd.builder.BuilderPostProcessor;
import com.codemonkey.lq.qd.facotry.config.SConfiguration;

/**
 * 仿MyBatis的MixedSqlNode(org.apache.ibatis.scripting.xmltags.MixedSqlNode)
 * @author LQ
 * @deprecated 暂未使用,因为在SConfiguration中使用的是集合存储BuilderPostProcessor
 */
public final class MixedBuilderPostProcessor implements BuilderPostProcessor {

	private List<BuilderPostProcessor> processores = new ArrayList<BuilderPostProcessor>(5);

	
	public void addListener(BuilderPostProcessor processor){
		processores.add(processor);
	}

	
	@Override
	public void postProcessAfterBuild(BaseBuilder builder, Object obj, SConfiguration configuration) {
		for (BuilderPostProcessor processor : processores) {
			processor.postProcessAfterBuild(builder, obj, configuration);
		}
	}

	@Override
	public void postProcessBeforeBuild(BaseBuilder builder, SConfiguration configuration) {
		for (BuilderPostProcessor processor : processores) {
			processor.postProcessBeforeBuild(builder, configuration);
		}
	}

}
